package com.mypack.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.mypack.business.User;
import com.mypack.dao.UserDAO;

@Service("userManager")
public class UserManager {
	
	@Autowired
	private UserDAO userDAO;
	
	public Long saveUser(User user){
		return userDAO.saveUser(user);
	}
	
	public User getUser(User user){
		return userDAO.getUser(user);
	}
	
	public List<User> queryUser(User user){
		return userDAO.queryUser(user);
	}
	
	public List<User> queryUserByCompiledSQL(User user){
		return userDAO.queryUserByCompiledSQL(user);
	}
	
	@Transactional(propagation=Propagation.REQUIRED) 
	public void saveUserTrans(User user){
		System.out.println("trans");
		userDAO.saveUser(user);
		int i = 100 / 0;
	}
}
